﻿@model Storytelling.Modelos.FiltrarModel<Storytelling.Entidades.VTR.Coalizao>
@using Storytelling.Utils;
@using Storytelling.Entidades.VTR;
@{
    ViewBag.Title = "Coalizão";
}
<h2>Consultar Coalizões</h2>
@using (Html.BeginForm())
{  
    @Html.Filtro("filtro",
        @<text> 
            <div class="editor-label">
                Nome
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Exemplo.Nome)
            </div>

            <div class="editor-label">
                Inativado
            </div>
            <div class="editor-field">
                <select name="Exemplo.Inativado">
                    <option value=""></option>
                    <option value="true">Sim</option>
                    <option value="false">Não</option>
                </select>
            </div>

            <p>
                <input type="submit" value="Filtrar" />
            </p>
        </text>)
}

<table class="DataTable">
    <thead>
        <tr>
            <th>Nome</th>
            <th>Disciplinas</th>
            <th>Vantagens</th>
            <th>Inativado</th>
            <th>Descrição</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var itemCoalizao in Model.Colecao)
        {
            <tr>        
                <td><a href="/Coalizao/Form/@itemCoalizao.Id" class="Transicao">@itemCoalizao.Nome</a></td>
                <td>@(itemCoalizao.Disciplinas != null && itemCoalizao.Disciplinas.Count > 0 ? Html.DivOculta(string.Format("disciplina_{0}", itemCoalizao.Id), itemCoalizao, "Ocultar", "Exibir", 
                @<text>
                    <ul style="list-style: none; width: 170px">                     
                    @foreach (var itemDisciplina in item.Disciplinas)
                    {
                        <li>@itemDisciplina.Disciplina.Nome</li>                      
                    }
                    </ul>
                </text>) : new MvcHtmlString(""))</td>                
                <td>@(itemCoalizao.Vantagens != null && itemCoalizao.Vantagens.Count > 0 ? Html.DivOculta(string.Format("vantagem_{0}", itemCoalizao.Id), itemCoalizao, "Ocultar", "Exibir", 
                @<text>
                    <ul style="list-style: none; width: 170px">                     
                    @foreach (var itemVantagem in item.Vantagens)
                    {
                        <li>@itemVantagem.Vantagem.Nome</li>                      
                    }
                    </ul>
                </text>) : new MvcHtmlString(""))</td>
                <td><input type="checkbox" disabled="disabled" @(itemCoalizao.Inativado.Value ? "checked=\"checked\"" : "") /></td>                
                <td>@Html.DescricaoOculta(string.Format("descricao_{0}", itemCoalizao.Id), 60, "Ocultar", "Exibir", itemCoalizao.Descricao)</td>
                <td><input type="button" value="X" onclick="excluirItemGrid('/Coalizao/Excluir/@itemCoalizao.Id')" /></td>
            </tr>                    
        }
    </tbody>
</table>
<br/>
@Html.Opcoes(false, "Coalizao")
<br/>